package com.carryGo.entity;

/**
 * ClassName:PageManager
 * package:guoban
 * Desription:
 *
 * @Date:2020/8/26 19:51
 * @Author: 邓攀
 */
public class PageManager {

    private int pn = 1;//当前页
    private int rn = 10;//每页显示多少条数据
    private int totalCount;//总数据数
    private int pages;//总页数

    public PageManager() {
    }

    public int getPn() {
        return pn;
    }

    public void setPn(int pn) {
        this.pn = pn==0?this.pn:pn;
    }

    public int getRn() {
        return rn;
    }

    public void setRn(int rn) {
        this.rn = rn==0?this.rn:rn;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getPages() {
        return pages;
    }

    public void setPages(int pages) {
        this.pages = pages;
    }

    public void setPages() {
        int pages = totalCount / rn;
        if (totalCount % rn != 0) {
            pages++;
        }
        this.pages = pages;
    }

    @Override
    public String toString() {
        return "PageManager{" +
                "pn=" + pn +
                ", rn=" + rn +
                ", totalCount=" + totalCount +
                ", pages=" + pages +
                '}';
    }
}
